#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2021/4/19 10:01
# @Author  : LiShan
# @Email   : lishan_1997@126.com
# @File    : create_vehicle_inputs.py
# @Note    : this is note


# 生成车流量文件
content = []
heads = "序号\t时间\t西直\t西左\t东直\t东左\t南直\t南左\t北直\t北左\n"
content.append(heads)
n = 24
for i in range(n):
    line = "%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t\n" % (i, 3600*(i+1), 368, 216, 298, 244, 372, 152, 332, 210)
    content.append(line)

if (3600*n) < 999999:
    content.append("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t\n" % (n, 999999, 368, 216, 298, 244, 372, 152, 332, 210))

with open("../resource/data/vehicle_inputs.txt", "w") as f:
    f.write("".join(content))

# 读取车流量文件

with open("../resource/data/vehicle_inputs.txt", "r") as f:
    lines = f.readlines()
vehicle = []
for i in range(1, len(lines)):
    vehicle.append(list(map(int, lines[i].split())))
print(vehicle)
time = 144
num = 0
while True:
    if time < vehicle[num][1]:
        print(vehicle[num][2:])
        break
    else:
        num += 1
